home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / Sample Editors⁄Viewers / Text Editor / Source / TextEditor.idl < prev    next >
Encoding:
Text File  |  1995-12-13  |  10.8 KB  |  443 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        TextEditorUtils.idl
  3.  
  4.     Contains:    TextEditor object interface
  5.  
  6.     Written by:    Steve Smith
  7.  
  8.     Copyright:    © 1994-1995 by Apple Computer, Inc., all rights reserved.
  9. */
  10.  
  11.  
  12. #ifndef _TEXTEDITOR_
  13. #define _TEXTEDITOR_
  14.  
  15. #ifndef _PART_
  16. #include "Part.idl"
  17. #endif 
  18.  
  19. #ifndef _TEXTEDITORVERS_
  20. #include "TextEditorVers.h"
  21. #endif
  22.  
  23. //==============================================================================
  24. // Classes used by this interface
  25. //==============================================================================
  26.  
  27. interface  ODFocusSet;
  28. interface  ODMenuBar;
  29. interface  ODSession;
  30. interface  ODWindow;
  31. interface  ODFrame;
  32. interface  TextEditorSemIntf;
  33. interface  TextEditorSettingsExt;
  34. interface  TextEditorTransferExt;
  35.  
  36.  
  37. #ifdef __PRIVATE__
  38. //==============================================================================
  39. // Implementation Types
  40. //==============================================================================
  41.  
  42. typedef somToken CTSMTextension;
  43. typedef somToken CRulerUI;
  44. typedef somToken CPartRun;
  45. typedef somToken Handle;
  46. typedef somToken WindowProperties;
  47. typedef somToken CList;
  48. typedef somToken CFrameList;
  49. typedef somToken ControlHandle;
  50. typedef somToken DragData;
  51. typedef somToken Samples_PaletteExt;
  52.  
  53. #endif 
  54.  
  55. //==============================================================================
  56. // TextEditor
  57. //==============================================================================
  58.  
  59. module SampleCode
  60. {
  61.  
  62. interface TextEditor : ODPart
  63. {
  64. #ifdef __PRIVATE__
  65.  
  66.     // -- Initialization --
  67.     
  68.     void        Initialize();
  69.     
  70.     // -- Storage --
  71.     
  72.     ODShape        CalcNewUsedShape(in ODFrame frame);
  73.     void        UpdateFrame(in ODFrame frame, in ODTypeToken view, 
  74.                                             in ODShape usedShape);
  75.     WindowProperties* GetSavedWindowProperties(in ODFrame frame);
  76.     WindowProperties* GetDefaultWindowProperties(in ODFrame frame, in Rect windowRect);
  77.     void        CheckAndAddProperties(in ODStorageUnit storageUnit);
  78.     void        InternalizeStateInfo(in ODStorageUnit storageUnit);
  79.     ODULong        InternalizeContent(in ODStorageUnit storageUnit, in ODPtr selRange);
  80.     void        ExternalizeStateInfo(in ODStorageUnit storageUnit, 
  81.                                     in ODDraftKey key, in ODFrame scopeFrame);
  82.     void        ExternalizeContent(in ODStorageUnit storageUnit, in ODPtr selRange);
  83.     void        CleanseContentProperty(in ODStorageUnit storageUnit);
  84.     
  85.     // -- Event Handling --
  86.     
  87.     ODBoolean    HandleMenuEvent(in ODEventData event, in ODFrame frame);
  88.     ODBoolean    HandleWindowEvent(in ODEventData event, in ODFrame frame);
  89.     ODBoolean    HandleMouseEvent(in ODEventData event, in ODFacet facet, in ODEventInfo eventInfo);
  90.     ODBoolean    HandleRulerMouseEvent(in ODEventData event, in ODFacet facet, in ODEventInfo eventInfo);
  91.     void        DoMouseEvent(in ODFacet facet, in Point where, in ODEventData event);
  92.     ODBoolean    HandleKeyboardEvent(in ODEventData event, in ODFrame frame);
  93.     void        DoIdle(in ODFrame frame);
  94.     void        DoDialogBox(in ODFrame frame, in ODSShort dialogID, in ODUShort    errorNumber);
  95.     
  96.     // -- Imaging --
  97.     
  98.     void        DrawFrameView(in ODFacet facet);
  99.     void        DrawIconView(in ODFacet facet);
  100.     void        DrawThumbnailView(in ODFacet facet);
  101.     void        GenerateThumbnail(in ODFrame frame);
  102.     
  103.     // -- Activation --
  104.     
  105.     ODBoolean    ActivateFrame(in ODFrame frame);
  106.     void        WindowActivating(in ODFrame frame, in ODBoolean activating);
  107.     void        RelinquishAllFoci(in ODFrame frame);
  108.     ODBoolean    Activate(in ODFacet facet);
  109.     void        PartActivated(in ODFrame frame);
  110.     
  111.     // -- Layout --
  112.     
  113.     ODWindow    AcquireFramesWindow(in ODFrame frame);
  114.     ODWindow    CreateWindow(in ODFrame frame, in ODType frameType, 
  115.                                         in WindowProperties* windowProperties);
  116.     void        CleanupWindow(in ODFrame frame);
  117.     Rect        CalcPartWindowSize(in ODFrame sourceFrame);
  118.     Rect        CalcPartWindowPosition(in ODFrame frame, in Rect partWindowBounds);
  119.     ODFacet        GetActiveFacetForFrame(in ODFrame frame);
  120.     void        CleanupDisplayFrame(in ODFrame frame, in ODBoolean frameRemoved);
  121.     
  122.     // == Misc ==
  123.     
  124.     // -- Misc --
  125.     
  126.     void        SetDirty();
  127.     void        HandleChange();
  128.     void        CalcViewRect(in ODFrame frame);
  129.     ODBoolean    HasValidData(in ODStorageUnit su, out ODBoolean requiresTranslation);
  130.     void        UpdateScriptRunnerState();
  131.     
  132.     // -- Command Handling --
  133.     
  134.     void        DoAboutBox(in ODFrame frame);
  135.     void        DoCut(in ODFrame frame);
  136.     void        DoCopy(in ODFrame frame);
  137.     void        DoPaste(in ODFrame frame);
  138.     void        DoPasteAs(in ODFrame frame);
  139.     void        DoClear(in ODFrame frame);
  140.     void        DoSelectAll(in ODFrame frame);
  141.     void        DoPageSetup(in ODFrame frame);
  142.     void        DoPrint(in ODFrame frame);
  143.     void        DoUndo(in ODFrame frame, in ODBoolean undo);
  144.     void        DoPreferences(in ODFrame frame);
  145.     void        DoSettings(in ODFrame frame);
  146.     
  147.     // -- Selection --
  148.     
  149.     void        DoDragSelection(in ODEventData event, in ODFacet facet);
  150.     void        CalcSelectionRgn(in ODFacet facet);
  151.     
  152.     // -- I/O --
  153.     
  154.     void        StreamDataOut(in ODStorageUnitView suView, in ODPtr selRange, in ODUByte ioFlags);
  155.     ODSLong        StreamDataIn(in ODStorageUnitView suView, in ODPtr selRange, in ODUByte ioFlags);
  156.     ODBoolean    GetText(in ODPlatformType type, out ODPtr textPtr, out ODSize size);
  157.     ODBoolean    SetText(in ODPlatformType type, in ODPtr textPtr, in ODSize size);
  158.     
  159.     void        StartTextension();
  160.     void        InitializeTextension(in ODBoolean isRoot);
  161.     void        ActivateTextension(in ODFrame frame, in ODBoolean activate);
  162.     
  163.     // -- Text Bounds --
  164.     
  165.     void        CalcTextBounds(in ODFrame frame);
  166.     void        DrawPageBounds();
  167.     
  168.     // -- Scroll Bars --
  169.     
  170.     void        ActivateScrollbars(in ODBoolean activate);
  171.     void        AdjustScrollbars(in ODFrame frame);
  172.     void        RepositionScrollbars(in ODFrame frame);
  173.     void        MakeSelectionVisible(in ODFrame frame);
  174.     void        DoScrollDocument(in ODFacet facet, in Point mouse, in ODSShort partCode, 
  175.                                         in ControlHandle scrollbar);
  176.     
  177.     // -- Ruler --
  178.     
  179.     void        ShowHideRuler(in ODFrame frame);
  180.     
  181.     // -- Menus --
  182.     
  183.     void        LoadMenus();
  184.     ODBoolean    DoTextStyling(in ODFrame frame, in ODID command);
  185.     void        RealFontSizeMenu(in ODUShort fontNum);
  186.     void        AdjustEditMenu(in ODFrame frame);
  187.     void        AdjustTextEditorMenus(in ODFrame frame);
  188.     void        AdjustDynamicMenuItems(in ODFrame frame);
  189.     void        DoOtherFontSize(in ODFrame frame, inout ODSShort fontSize);
  190.     
  191.     // -- Cursor Tracking --
  192.     
  193.     void        MouseEnter(in ODFacet facet, in ODPoint where);
  194.     void        MouseWithin(in ODFacet facet, in ODPoint where);
  195.     void        MouseLeave(in ODFacet facet);
  196.     
  197.     // -- Misc. --
  198.     
  199.     ODBoolean    NotDragSelection(in ODFacet facet, in Point where, in ODEventData event);
  200.     ODBoolean    TranslateForeignData(in ODStorageUnit su);
  201.     
  202. #endif 
  203.  
  204. #ifdef __SOMIDL__
  205.     implementation
  206.     {
  207.         majorversion = currentMajorVersion;
  208.         minorversion = currentMinorVersion;
  209.         
  210.         functionprefix = TextEditor__;
  211.  
  212.         override:
  213.             //# ODObject methods
  214.             somInit,
  215.             somUninit,
  216.             AcquireExtension,
  217.             HasExtension,
  218.             Purge,
  219.             ReleaseExtension,
  220.  
  221.             //# ODRefCountedObject methods
  222.             Release,
  223.             
  224.             //# ODPersistentObject methods.
  225.             CloneInto,
  226.             Externalize,
  227.             ReleaseAll,
  228.             
  229.             //# ODPart methods
  230.             AbortRelinquishFocus,
  231.             AdjustBorderShape,
  232.             AdjustMenus,
  233.             AttachSourceFrame,
  234.             BeginRelinquishFocus,
  235.             CanvasChanged,
  236.             CanvasUpdated,
  237.             ChangeKind,
  238.             ClonePartInfo,
  239.             CommitRelinquishFocus,
  240.             ContainingPartPropertiesUpdated,
  241.             CreateLink,
  242.             DisplayFrameAdded,
  243.             DisplayFrameClosed,
  244.             DisplayFrameConnected,
  245.             DisplayFrameRemoved,
  246.             DisposeActionState,
  247.             DragEnter,
  248.             DragLeave,
  249.             DragWithin,
  250.             Draw,
  251.             Drop,
  252.             ExternalizeKinds,
  253.             FacetAdded,
  254.             FacetRemoved,
  255.             FocusAcquired,
  256.             FocusLost,
  257.             FrameShapeChanged,
  258.             FulfillPromise,
  259.             GeometryChanged,
  260.             GetPrintResolution,
  261.             HandleEvent,
  262.             HighlightChanged,
  263.             InitPart,
  264.             InitPartFromStorage,
  265.             LinkStatusChanged,
  266.             LinkUpdated,
  267.             Open,
  268.             PresentationChanged,
  269.             ReadActionState,
  270.             ReadPartInfo,
  271.             RedoAction,
  272.             RevealLink,
  273.             SequenceChanged,
  274.             UndoAction,
  275.             ViewTypeChanged,
  276.             WriteActionState,
  277.             WritePartInfo;
  278.     
  279.         releaseorder:
  280.             Initialize,
  281.             CalcNewUsedShape,
  282.             UpdateFrame,
  283.             GetSavedWindowProperties,
  284.             GetDefaultWindowProperties,
  285.             CheckAndAddProperties,
  286.             InternalizeStateInfo,
  287.             InternalizeContent,
  288.             ExternalizeStateInfo,
  289.             CleanseContentProperty,
  290.             ExternalizeContent,
  291.             HandleMenuEvent,
  292.             HandleWindowEvent,
  293.             HandleMouseEvent,
  294.             HandleRulerMouseEvent,
  295.             DoMouseEvent,
  296.             HandleKeyboardEvent,
  297.             DrawFrameView,
  298.             DrawIconView,
  299.             DrawThumbnailView,
  300.             ActivateFrame,
  301.             WindowActivating,
  302.             AcquireFramesWindow,
  303.             CreateWindow,
  304.             CalcPartWindowSize,
  305.             CalcPartWindowPosition,
  306.             SetDirty,
  307.             DoAboutBox,
  308.             DoDialogBox,
  309.             GenerateThumbnail,
  310.             GetActiveFacetForFrame,
  311.             CalcViewRect,
  312.             ActivateTextension,
  313.             ActivateScrollbars,
  314.             HasValidData,
  315.             DoCut,
  316.             DoCopy,
  317.             DoPaste,
  318.             DoPasteAs,
  319.             DoClear,
  320.             DoSelectAll,
  321.             DoPageSetup,
  322.             DoPrint,
  323.             DoUndo,
  324.             DoPreferences,
  325.             DoSettings,
  326.             DoIdle,
  327.             DoDragSelection,
  328.             CalcSelectionRgn,
  329.             StreamDataOut,
  330.             StreamDataIn,
  331.             GetText,
  332.             SetText,
  333.             StartTextension,
  334.             InitializeTextension,
  335.             CalcTextBounds,
  336.             AdjustScrollbars,
  337.             RepositionScrollbars,
  338.             MakeSelectionVisible,
  339.             DoScrollDocument,
  340.             ShowHideRuler,
  341.             LoadMenus,
  342.             DoTextStyling,
  343.             DrawPageBounds,
  344.             RealFontSizeMenu,
  345.             AdjustEditMenu,
  346.             AdjustTextEditorMenus,
  347.             AdjustDynamicMenuItems,
  348.             DoOtherFontSize,
  349.             MouseEnter,
  350.             MouseWithin,
  351.             MouseLeave,
  352.             NotDragSelection,
  353.             Activate,
  354.             TranslateForeignData,
  355.             RelinquishAllFoci,
  356.             PartActivated,
  357.             CleanupWindow,
  358.             CleanupDisplayFrame,
  359.             HandleChange,
  360.             UpdateScriptRunnerState;
  361.     
  362.     #ifdef __PRIVATE__
  363.     
  364.             passthru C_xh =
  365.                 ""
  366.                 "class CPartRun;"
  367.                 "class Samples_PaletteExt;"
  368.                 ""
  369.                 "#ifndef _WINUTILS_"
  370.                 "#include <WinUtils.h>"
  371.                 "#endif"
  372.                 ""
  373.                 "#ifndef SOM_TextEditorSemIntf_xh"
  374.                 "#include <TextEditorSemIntf.xh>"
  375.                 "#endif"
  376.                 ""
  377.                 "#ifndef SOM_TextEditorSettingsExt_xh"
  378.                 "#include <TextEditorSettingsExt.xh>"
  379.                 "#endif"
  380.                 ""
  381.                 "#ifndef SOM_TextEditorTransferExt_xh"
  382.                 "#include <TextEditorTransferExt.xh>"
  383.                 "#endif"
  384.                 ""
  385.                 "#ifndef _SAMPLECOLLECTIONS_"
  386.                 "#include <SampleCollections.h>"
  387.                 "#endif"
  388.                 ""
  389.                 "#include <Printing.h>"
  390.                 "#include <Controls.h>"
  391.                 "#include <Quickdraw.h>";
  392.             
  393.             passthru C_xih =
  394.                 ""
  395.                 "class CList;"
  396.                 "class CFrameList;"
  397.                 "class CTSMTextension;"
  398.                 "class CRulerUI;"
  399.                 "class Samples_PaletteExt;"
  400.                 "class DragData;"
  401.                 "";
  402.         
  403.             ODPart                    fSelf;
  404.             CList*                    fDisplayFrames;
  405.             ODBoolean                fDirty;
  406.             ODBoolean                fReadOnlyStorage;
  407.             TextEditorSemIntf        fSemanticIntf;
  408.             TextEditorSettingsExt    fSettingsExt;
  409.             TextEditorTransferExt    fTextTransferExt;
  410.     
  411.             Handle                    fSelectionRgn;
  412.             DragData*                fDragData;
  413.             
  414.             CTSMTextension*            fTextension;
  415.             ODBoolean                fTextensionInitialized;
  416.             ODID                    fRulerPalette;
  417.             Handle                    fPrintRecord;
  418.             
  419.             ODTypeToken                fPreferredKind;
  420.             
  421.             Rect                    fPaperSize;
  422.             Rect                    fPageSize;
  423.             Rect                    fPageMargins;
  424.             ODUShort                fTextAlignment;
  425.             
  426.             ControlHandle            fVScrollbar;
  427.             ControlHandle            fHScrollbar;
  428.             
  429.             Samples_PaletteExt*        fScriptPaletteExt;
  430.             ODBoolean                fIsScriptRunnerOn;
  431.             ODBoolean                fIsScriptRunnerHidden;
  432.     
  433.         #endif 
  434.     
  435.         };    // implementation
  436.   
  437. #endif
  438.     };        // interface
  439. };      // module
  440.  
  441. #endif    // _ODTEXTEDITOR_
  442.  
  443.